<?php require APP_ROOT.'public/top.php';?>
<link href="css/add.css"  rel="stylesheet" type="text/css" />
  <?php
$type_id=pg('type_id');
$group_id=pg('group_id');
$group=M('group')->where(array('group_id'=>$group_id))->find();
?>

<div id="bread" style="background-color:#F2F2F2;padding:2px 10px;width:100%;z-index:999" class=""><a class="light-blue test" href="/adplan/list">投放管理</a> &gt; <a class="light-blue" href="/adplan/modify/?plan_id="></a> &gt; <a class="light-blue" href="/adgroup/modify/?group_id="></a> &gt; 新建创意</div>
<div class="f-cb">
  <div class="g-ct" style="margin-left:0">
    <h3 class="g-ct-title f-cb" style="border-bottom:none">
      <div style="float:left;line-height:30px;margin-left:5%;width:33%">
        <div class="step1-circle" style="background-color: darkgray; border-radius: 100px; float: left; height: 30px; line-height: 30px; text-align: center; width: 30px;"><span class="step1" style="color:#FFF;font-weight:700;line-height:1">1</span></div>
        <span class="step1-desc" style="color: darkgray; font-weight: normal; font-size: 14px;"> &nbsp;&nbsp;&nbsp;&nbsp;第一步 设置推广计划&nbsp;&nbsp;&nbsp;&nbsp;------------------------------------</span></div>
      <div style="float:left;line-height:30px;width:31%">
        <div class="step2-circle" style="align:center;background-color:darkgray;-webkit-border-radius:100px;float:left;height:30px;line-height:30px;text-align:center;width:30px"><span class="step2" style="color:#FFF;font-weight:700;line-height:1">2</span></div>
        <span class="step2-desc" style="color: darkgray; font-weight: normal; font-size: 14px;">&nbsp;&nbsp;&nbsp;&nbsp;第二步 设置推广组&nbsp;&nbsp;&nbsp;&nbsp;------------------------------------</span></div>
      <div style="float:left;line-height:30px;width:31%">
        <div class="step3-circle" style="background-color: rgb(0, 153, 60); border-radius: 100px; float: left; height: 30px; line-height: 30px; text-align: center; width: 30px;"><span class="step3" style="color:#FFF;font-weight:700;line-height:1">3</span></div>
        <span class="step3-desc" style="color: black; font-weight: bold; font-size: 14px;"> &nbsp;&nbsp;&nbsp;&nbsp;第三步 设置推广创意</span></div>
    </h3>

    <form action="index.php?m=cms&a=add_save" method="post" enctype="multipart/form-data" class="c-form c-form-validate2" id="cy_form" style="margin-top:10px" onsubmit="return return_message()" novalidate="novalidate">
        <input name="data[date]" type="hidden" id="date" value="<?php echo time();?>" />
        <input name="data[version_id]" type="hidden" id="version_id" value="1" />
        <input name="data[type_id]" type="hidden" id="type_id" value="<?php echo $type_id;?>" />

      <input type="hidden" id="plan_id" name="data[plan_id]" value="<?php echo $group['plan_id'];?>">
      <input type="hidden" id="group_id" name="data[group_id]" value="<?php echo $group_id;?>">
      <div class="f-cb">
        <div class="js-options " style="">
          <ul class="plan-group-slt">
            <!--
            <li> <span class="plan-group-slt-tit">推广计划</span>
              <label id="plan_select" class="w-select" style="width:200px;z-index:200"> <i class="w-select-icon f-efonts">󰅰</i> <a href="javascript:void(0)" class="w-select-button planid">请选择</a>
                <input type="hidden" name="campaignid" id="campaignid" value="">
                <span class="w-select-lists" style="overflow-y: scroll; height: 300px; visibility: visible; width: 200px;">
                <?php
		$plan = M('plan')->where(array())->select();
		foreach($plan as $k2=>$v2){
		?>
                <a value="<?php echo $v2['plan_id'];?>" title="<?php echo $v2['plan_name'];?>" data-ad-type="2" data-os="1" data-appid="0" data-target="2" data-model="RTB" onclick="getplanid($(this))"><?php echo $v2['plan_name'];?></a>
                <?php } ?>
                </span></label>
              <span class="cy-default"></span> </li>
              -->
              
            <li> <span class="plan-group-slt-tit">推广组</span>
              <label id="group_select" class="w-select" style="width:200px;z-index:100"> <i class="w-select-icon f-efonts">󰅰</i> <a href="javascript:void(0)" class="w-select-button groupid"><?php echo $group_id==''?'选择推广组':$group['group_name'];?></a>
                <input type="hidden" name="solutionid" id="solutionid" value="">
                <span class="w-select-lists" style="overflow-y: scroll; height: 300px; visibility: visible; width: 200px;">
                <?php
		$group = M('group')->where(array('member_id'=>$member_id))->select();
		foreach($group as $k2=>$v2){
		?>
                <a value="<?php echo $v2['group_id'];?>" title="<?php echo $v2['group_name'];?>" data-ad-type="2" data-os="1" data-appid="0" data-target="2" data-model="RTB" onclick="getgroupid($(this))"><?php echo $v2['group_name'];?></a>
                <?php } ?>
                </span></label>
              <span class="cy-default"></span> </li>
            <li> <span class="plan-group-slt-tit"><em class="cy-must">*</em>创意名称<i class="f-efonts j-tips" data-tips="不超过20个汉字或40个字符"></i></span>
              <input name="data[originality_name]" id="originality_name" class="c-input required" placeholder="请输入创意名称" type="text" value="">
              <span class="cy-default"></span> </li>
            <li> <span class="plan-group-slt-tit">创意类型</span>
              <?php
		$input_p = M('input')->where(array('input_pid'=>590))->select();
		foreach($input_p as $k2=>$v2){
		?>
              <label class="js-product-limit">
                <input class="f-vam" type="radio" id="originality_type" name="data[originality_type]" value="<?php echo $v2['input_value'];?>" onChange="origination_type(<?php echo $v2['input_value'];?>)">
                <?php echo $v2['input_name'];?> &nbsp;&nbsp;&nbsp;&nbsp;</label>
              <?php }?>
            </li>
          </ul>
          <div class="cy-tbl-input">
            <div class="spread-matter">
              <h2>推广素材</h2>
              <dl class="f-cb">
                <dt><em class="cy-must">*</em>标题<i class="f-efonts j-tips" data-tips="不超过4个汉字或8个字符"></i> </dt>
                <dd>
                  <p>
                    <input class="c-input" type="text" name="data[tgtitle]" id="tgtitle" value="" placeholder="请输入标题">
                    <span class="cy-default"></span></p>
                </dd>
              </dl>
              <dl class="f-cb ">
                <dt><em class="cy-must">*</em>图片上传<i class="f-efonts j-tips" data-tips="尺寸72*72"></i> </dt>
                <dd id="upload_btn_container_72x72" class="js-upload-btn-container">
                  <input type="file" capture="camera" name="originality_img" id="originality_img" class="webuploader-element-invisible fileContainer originality_img1" multiple="multiple" accept="" style="position:absolute;z-index: 1000;opacity: 0;">
                  <img src="" height="200" alt="" class="fileContain fileContainer1" style="position:absolute; z-index:999;">
                  <span class="fileContainer img-upload-logo " id="upload-logo-container" data-size="72x72" data-limit="150"> <img class="js-upload-img-src" src=""> <span class="img-upload-change"></span>
                  <input type="hidden" name="logo" class="js-uploaded-image-url" value="">
                  </span> </dd>
                  <dd id="upload_btn_container_72x72" class="js-upload-btn-container container2" style="display:none;">
                  <input type="file" capture="camera" name="originality_img2" id="originality_img2" class="webuploader-element-invisible fileContainer originality_img2" multiple="multiple" accept="image/jpeg,image/png" style="position:absolute;z-index: 1000;opacity: 0;">
                  <img src="" height="200" alt="" class="fileContain fileContainer2" style="position:absolute; z-index:999;">
                  <span class="fileContainer img-upload-logo " id="upload-logo-container" data-size="72x72" data-limit="150"> <img class="js-upload-img-src" src=""> <span class="img-upload-change"></span>
                  <input type="hidden" name="logo" class="js-uploaded-image-url" value="">
                  </span> </dd>
                  <dd id="upload_btn_container_72x72" class="js-upload-btn-container container3" style="display:none;">
                  <input type="file" capture="camera" name="originality_img3" id="originality_img3" class="webuploader-element-invisible fileContainer originality_img3" multiple="multiple" accept="image/jpeg,image/png" style="position:absolute;z-index: 1000;opacity: 0;">
                  <img src="" height="200" alt="" class="fileContain fileContainer3" style="position:absolute; z-index:999;">
                  <span class="fileContainer img-upload-logo " id="upload-logo-container" data-size="72x72" data-limit="150"> <img class="js-upload-img-src" src=""> <span class="img-upload-change"></span>
                  <input type="hidden" name="logo" class="js-uploaded-image-url" value="">
                  </span> </dd>
              </dl>
            </div>
            <div class="spread-content">
              <h2>推广内容</h2>
              <dl class="f-cb">
                <dt><span class="ad_dt_deeplink ad_dt_tit"><em class="cy-must">*</em>下载链接<i class="f-efonts j-tips" data-tips="请填写下载链接"></i></span> </dt>
                <dd>
                  <input class="c-input" type="text" name="data[down]" id="down" value="" placeholder="请填写Deeplink链接">
                  <span class="cy-default"></span></dd>
              </dl>
              <dl class="f-cb">
                <dt><em class="cy-must">*</em>H5链接<i class="f-efonts j-tips" data-tips="为满足IOS广告投放条件，链接请使用https协议"></i> </dt>
                <dd>
                  <input class="c-input" type="text" name="data[h5url]" id="h5url" value="" placeholder="请输入与注册域名一致的H5链接">
                  <span class="cy-default"></span></dd>
              </dl>
            </div>
          </div>
          
          <div class="f-cb cy-input-btns">
            <p class="f-red f-vam js-submit-error" style="padding:10px 0 10px 0;visibility:hidden">在每一个文案元素(标题或子标题或描述)中，每一类通配符只能使用一次</p>
            <a id="submit_btn" class="c-btn1" href="javascript:adsubmit()">提交创意</a> <a id="cancel" class="c-btn2" href="index.php?m=originality&a=index&type_id=65" style="margin-left:20px">取消</a></div>
        </div>
      </div>
      <div class="f-cb" id="cy_input_box" style="display:none"></div>
      <input type="hidden" name="_csrf" value="RlVDNm9YTzkjHXRCBA18bRkNdn4YKTkLJC8LQTd1JmojMy1.WjIXbw==">
    </form>
  </div>
</div>

<script>
    //定时轮询fileContainer1,如果src有数据且有mp4,则展示默认的链接
    setInterval(function(){
        var fileContainerurl = $('.fileContainer1').attr('src');
        if(fileContainerurl.indexOf('video/mp4')!= -1){
            $('.fileContainer1').attr('src','images/chuangyi.jpg');
        }

        }, 3000);


function adsubmit(){
	$('#cy_form').submit();
}
function getplanid(obj)
{
	$("#plan_id").val(obj.attr("value"));
	$(".planid").html(obj.html());
}
function getgroupid(obj)
{
	$("#group_id").val(obj.attr("value"));
	$(".groupid").html(obj.html());
}

function ronshow(i)
{
	if(i==1)
	{
		$('.test-div').show();
		$('.closer').show();
	}
	else
	{
		$('.test-div').hide();
		$('.closer').hide();
	}
}

function previewFile(i) {
  var preview = document.querySelector('img');
  var file    = $(".originality_img"+i).files[0];
  var reader  = new FileReader();

  reader.onloadend = function () {
    preview.src = reader.result;
      alert(4)
	$(".fileContainer"+i).attr("src",reader.result);
  }

  if (file) {

    reader.readAsDataURL(file);
  } else {
    preview.src = "";
  }
}


</script>


</script> 




<?php require APP_ROOT.'public/bottom.php';?>
